const express = require('express')
const router = express.Router()
const config = require('../config');
const expressJWT = require('express-jwt');
const product_handler = require('../router_handler/product')

//发布商品
router.post('/release', expressJWT({ secret: config.jwtSecretKey }), product_handler.releaseGoods)
//获取商品信息
router.get('/productinfo', product_handler.getproductInfo)
//获取商品信息列表
router.get('/productlist', product_handler.getProductList)
//根据类型查询商品信息
router.get('/producttage', product_handler.getProductTageInfo)
//搜索栏进行模糊查询
router.post('/fuzzySearch', product_handler.fuzzySearch)
//查询自己发布的商品
router.get('/productbyown', expressJWT({ secret: config.jwtSecretKey }), product_handler.getProductInfoBYown)
//删除商品信息
router.post('/deleteproduct', expressJWT({ secret: config.jwtSecretKey }), product_handler.deleteProductInfo)
//添加历史搜索
router.post('/historySearch', product_handler.historySearch)
//获取历史搜索
router.get('/gethistory', product_handler.gethistorySearch)
//标记商品失效
router.post('/failureTage', expressJWT({ secret: config.jwtSecretKey }), product_handler.failureTage)
//获取失效的商品
router.get('/getfailureTage', expressJWT({ secret: config.jwtSecretKey }), product_handler.getFailureProduct)
module.exports = router